<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="${pageContext.request.contextPath}/merchantOrder/merchantOrder/list" method="post">
		<!-- 分页表单参数 -->
		<%@include file="/WEB-INF/page/inc/pageForm.jsp"%>
		<!-- 需要排序的字段 -->
		<input type="hidden" name="orderField" value="${requestScope.dwzPageBean.countResultMap.orderField}" />
		<!-- 正序倒序 -->
		<input type="hidden" name="orderDirection" value="${requestScope.dwzPageBean.countResultMap.orderDirection}" />

		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td><label style="width: 55px;">订单状态：</label> <select name="orderProcess" class="combox">
							<option value="" selected="selected"}>全部订单</option>
							<option value="0" ${requestScope.dwzPageBean.countResultMap.orderProcess == 0 ? 'selected':''}>新订单</option>
							<option value="1" ${requestScope.dwzPageBean.countResultMap.orderProcess == 1 ? 'selected':''}>已受理</option>
							<option value="2" ${requestScope.dwzPageBean.countResultMap.orderProcess == 2 ? 'selected':''}>待收货</option>
							<option value="6" ${requestScope.dwzPageBean.countResultMap.orderProcess == 6 ? 'selected':''}>退款中</option>
							<option value="7" ${requestScope.dwzPageBean.countResultMap.orderProcess == 7 ? 'selected':''}>已退货</option>
							<option value="8" ${requestScope.dwzPageBean.countResultMap.orderProcess == 8 ? 'selected':''}>取消订单</option>
							<option value="9" ${requestScope.dwzPageBean.countResultMap.orderProcess == 9 ? 'selected':''}>完成</option>
					</select></td>
					<td>订单编号： <input size="25" placeholder="请输入订单编号" name="org2.orderNum" type="text" postField="orderNum" suggestFields="orderNum" suggestUrl="${pageContext.request.contextPath}/merchantOrder/merchantOrder/getOrderNum" lookupGroup="org2" value="${requestScope.dwzPageBean.countResultMap.orderNum}" />
					</td>
					<td>店铺名称： <input size="25" placeholder="请输入店铺名称" name="org2.shopName" type="text" postField="shopName" suggestFields="shopName" suggestUrl="${pageContext.request.contextPath}/merchantOrder/merchantOrder/getShopName" lookupGroup="org2" value="${requestScope.dwzPageBean.countResultMap.shopName}" />
					</td>
					<td>下单时间：<input name="startTime" class="date textInput readonly" readonly="true" type="text" value="${requestScope.dwzPageBean.countResultMap.startTime}" placeholder="请选择下单时间" style="margin-right: 5px;">至<input style="margin-left: 5px;" name="endTime" class="date textInput readonly" readonly="true" minDate="" type="text" value="${requestScope.dwzPageBean.countResultMap.endTime}" placeholder="请选择下单时间"></td>
				</tr>
				<tr>
					<td><label class="nowrap" style="width: 55px;">省：</label> <input type="hidden" name="areaName" class="required" value="${requestScope.record.areaName}" /> <select class="combox required" name="areaCode" id="ol_combox_province" ref="ol_combox_city" refUrl="${pageContext.request.contextPath}/system/areas/getCityByProvince?id={value}&isSearch=true" default-value="110000">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.provinces}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.province?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<td><label class="nowrap" style="width: 55px;">市：</label><select class="combox required" name="areaCode" id="ol_combox_city" ref="ol_combox_region" refUrl="${pageContext.request.contextPath}/system/areas/getCountyByAreas?id={value}&isSearch=true" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.citys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.city?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<td><label class="nowrap" style="width: 55px;">区：</label><select class="combox required" name="areaCode" id="ol_combox_region" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.countys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.county?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<td>
						<ul>
							<li>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="submit">查询</button>
									</div>
								</div>
							</li>
						</ul>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="/merchantOrder/merchantOrder/export">
				<li><a href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/export" target="dwzExport" targetType="navTab" title="确定要导出这些记录吗?" class="icon"><span>导出EXCEL</span></a></li>
			</shiro:hasPermission>
			
			<%-- <shiro:hasPermission name="/merchantOrder/merchantOrder/toInsertMerchantOrder">
				<li><a class="add" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/toInsertMerchantOrder" rel="insert" target="dialog" mask="true" width="820" height="460"><span>添加</span></a></li>
			</shiro:hasPermission> --%>
			
		</ul>
	</div>
	<table class="table" targetType="navTab" width="100%" layoutH="138">
		<thead>
			<tr>
				<th orderField="sname" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'sname'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>店铺名</th>
				<th orderField="order_process" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'order_process'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>订单状态</th>
				<th orderField="mbcount" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'mbcount'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>进货数量</th>
				<th orderField="saddress" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'saddress'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>店铺地址</th>
				<th orderField="scontacts" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'scontacts'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>联系人</th>
				<th orderField="aphone" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'aphone'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>联系电话</th>
				<th orderField="sename" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'sename'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>订单创建人</th>
				<th orderField="add_time" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'add_time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>下单时间</th>
				<th orderField="mename" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'mename'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>总店操作人</th>
				<th orderField="spname" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'spname'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>分店操作人</th>
				<th orderField="update_time" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'update_time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>最近更新时间</th>
				<th orderField="rvrm"  width="150" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'rvrm'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
				<c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
					<tr ondblclick="openDetails(this)" target="dialog" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/OrderList?orid=${record.merchantOrderId}" title="详情">
						<td>${record.sname}</td>
						<td>${record.orderProcess == 0 ? '新订单': ''}${record.orderProcess == 1 ? '已受理': ''}${record.orderProcess == 2 ? '待收货': ''}${record.orderProcess == 6 ? '退款中': ''}${record.orderProcess == 7 ? '已退货': ''}${record.orderProcess == 8 ? '取消订单': ''}${record.orderProcess == 9 ? '完成': ''}</td>
						<td>${record.mbcount}</td>
						<td>${record.saddress}</td>
						<td>${record.scontacts}</td>
						<td>${record.aphone}</td>
						<td>${record.sename}</td>
						<td><fmt:formatDate value="${record.addTime}" pattern='yyyy-MM-dd' /></td>
						<td>${record.mename}</td>
						<td>${record.spname}</td>
						<td><fmt:formatDate value="${record.updateTime}" pattern='yyyy-MM-dd'/></td>
						<td>${record.rvrm}</td>
						<td><shiro:hasPermission name="/merchantOrder/merchantOrder/OrderList">
								<a target="dialog" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/OrderList?orid=${record.merchantOrderId}" class="detailsBtn" mask="true" width="820" height="460"><span>详情</span></a>
							</shiro:hasPermission> <c:if test="${requestScope.depart == '财务部'}">
								<shiro:hasPermission name="/merchantOrder/merchantOrder/updateOrder">
									<c:if test="${record.orderProcess == 0}">
										<%-- <a title="确定要接受订单吗？" class="editBtn" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/updateOrder?id=${record.merchantOrderId}&str=accept" target="ajaxTodo"><span>接受订单</span></a> --%>
									 	<a title="接受订单" target="dialog" class="editBtn" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/toReview?id=${record.merchantOrderId}" mask="true" width="820" height="460"><span>接受订单</span></a>
									</c:if>
								</shiro:hasPermission>
							</c:if> <c:if test="${requestScope.depart == '仓库部'}">
								<shiro:hasPermission name="/merchantOrder/merchantOrder/updateOrder">
									<c:if test="${record.orderProcess == 1}">
										<a title="确定要发货订单吗？" class="editBtn" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/updateOrder?id=${record.merchantOrderId}&str=send" target="ajaxTodo"><span>发货订单</span></a>
									</c:if>
								</shiro:hasPermission>
							</c:if> <shiro:hasPermission name="/merchantOrder/merchantOrder/updateOrder">
								<c:if test="${record.orderProcess == 0 || record.orderProcess == 1 || record.orderProcess == 2}">
									<a title="确定要取消订单吗？" class="editBtn" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/updateOrder?id=${record.merchantOrderId}&str=cancel" target="ajaxTodo"><span>取消订单</span></a>
								</c:if>
							</shiro:hasPermission> 
							<shiro:hasPermission name="/merchantOrder/merchantOrder/finishOrder">
								<c:if test="${record.orderProcess == 2}">
									<a title="确定要完成订单吗？" class="editBtn" href="${pageContext.request.contextPath}/merchantOrder/merchantOrder/finishOrder?id=${record.merchantOrderId}" target="ajaxTodo"><span>完成订单</span></a>
								</c:if>
							</shiro:hasPermission></td>
					</tr>
				</c:forEach>
			</c:if>
		</tbody>
	</table>
	<!-- 分页条 -->
	<%@include file="/WEB-INF/page/inc/pageBar.jsp"%>
</div>